<template>
  <div class="base-table-box">
    <div class="table-select-group">
      <div class="left">
        <s-select
          :selectOption="year"
          v-model="params.strYear"
          style="width: 100px"
        />
        <a-tree-select
          style="width: 200px"
          :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
          :tree-data="treeData"
          tree-default-expand-all
          :treeIcon="true"
          :showSearch="true"
          v-model="topicTypeVal"
        >
        </a-tree-select>
        <a-select default-value="">
          <a-select-option value="">=是否采编= </a-select-option>
          <a-select-option value="0"> 是 </a-select-option>
          <a-select-option value="1"> 否 </a-select-option>
        </a-select>
        <s-select
          :selectOption="socialPublic.selectType"
          v-model="params.strPubType"
          style="width: 100px"
        />
        <a-input
          class="search-input"
          v-model="params.search"
          placeholder="请输入搜索内容"
        />
        <a-button style="margin-left: 16px" type="primary" @click="start"
          >查询</a-button
        >
        <a-button @click="reset" class="btn-reset">重置</a-button>
      </div>
    </div>
    <a-table
      :pagination="pagination"
      :columns="columns"
      :data-source="tableData"
      :loading="loading"
      :scroll="{ y: '100%' }"
    >
      <div slot="state" slot-scope="text">
        {{ text }}
      </div>
      <template slot-scope="text, record, index" slot="listIndex">
        <span>{{ index + 1 }}</span>
      </template>
    </a-table>
  </div>
</template>
<script>
import paging from 'mixins/paging'
import deleteItem from 'mixins/delete-table-item.js'
import { socialPublic } from 'assets/js/select-option-list'
const columns = [
  {
    title: '序号',
    scopedSlots: { customRender: 'listIndex' }
  },
  {
    title: '信息标题',
    dataIndex: 'title'
  },
  {
    title: '上报人',
    dataIndex: 'person'
  },
  {
    title: '上报类型',
    dataIndex: 'type',
    scopedSlots: { customRender: 'state' }
  },
  {
    title: '提交时间',
    dataIndex: 'time',
    sorter: (a, b) => a.name.length - b.name.length
  }
]

export default {
  data() {
    return {
      topicTypeVal: '',
      treeData: [
        {
          title: '=主题类型=',
          value: '',
          key: '1'
        },
        {
          title: '文化建设',
          value: '文化建设',
          key: '2',
          children: [
            {
              value: '街道文化建设',
              key: '2-1',
              title: '街道文化建设'
            }
          ]
        },
        {
          title: '经济建设',
          value: '经济建设',
          key: '3'
        },
        {
          title: '政协建设',
          value: '政协建设',
          key: '4'
        }
      ],
      isAdvanced: false,
      isJointname: 1, //是否联名
      columns,
      socialPublic,
      params: {
        strYear: '2021',
        strPubType: 'all',
        strPubNode: 'all',
        search: ''
      },
      year: [
        { key: '2021', label: '2021' },
        { key: '2020', label: '2020' }
      ],
      labelCol: { span: 6 },
      wrapperCol: { span: 18 }
    }
  },
  mixins: [paging, deleteItem],
  methods: {
    toggle() {
      this.isAdvanced = !this.isAdvanced
    },
    start() {
      console.log(this.form)
    },
    reset() {
      this.form = {}
    },
    add() {},
    deleteList(ids) {
      this.deleteItemMixins(() => {}, ids)
    },
    getTableData() {
      for (let i = 0; i < this.pagination.pageSize; i++) {
        this.tableData.push({
          key: i,
          title: `Edward King ${i}`,
          person: '张三',
          time: `20210303`
        })
      }
      this.pagination.total = 200
    }
  }
}
</script>
<style lang="less" scoped>
.tools span:last-child {
  margin: 0 0 0 15px;
}
.tools span {
  color: #1c8de8;
  cursor: pointer;
  font-size: 16px;
}
.ant-form-inline .ant-form-item {
  width: 100%;
}
</style>